package com.study.dao;

import com.study.domain.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface IUserDao {
    @Select("select * from user")
    @Results(id="userMap",
            value={
                    @Result(id=true,column = "uid",property = "uid"),
                    @Result(column = "name",property = "name"),
                    @Result(column = "empno",property = "empno"),
                    @Result(column = "empno",property = "emp",one=@One(select="com.study.dao.IEmpDao.findById",fetchType = FetchType.LAZY))
            })
    List<User> findAll();
    @Select("select * from user where empno=#{empno}")
    List<User> findByEmpno(int empno);
}
